<template>
	<view class="page">
		<view class="topbox">
			<view class="infobox">
				<view class="imgbox" @click="changetouxiang">
					<image  :src="imgurl ? 'https://changban.dianjingkeji.net' +imgurl : 'https://changban.dianjingkeji.net/img/微信图片_20250923172704_692_133.jpg'" mode=""></image>
					
				</view>
				<view class="info">
					<view class="nameline">
						<view class="name">
							{{pro.memberName||"新用户"}}
						</view>
						<view class="user">
							{{pro.memberLevel==1?'普通用户':pro.memberLevel==3?'专病会员':pro.memberLevel==4?'银卡会员':pro.memberLevel==5?'金卡会员':pro.memberLevel==6?'黑卡会员':''}}
						</view>
					</view>
					<view class="number">
						{{pro.memberPhone}}
					</view>
					
				</view>
			</view>
			<view class="backbox">
				<view class="iconfont icon-w_heiban">
					
				</view>
				<view class="content">
					专享服务·健康保障·名医问答
				</view>
				<view class="more" @click="waitlook">
					更多详情
					<view class="iconfont icon-xiangyou1">
						
					</view>
				</view>
			</view>
		</view>
		<view class="bannerbox">
			<view class="itembanner" @click="myorder">
				<view class="iconfont icon-qingdan">
					
				</view>
				<view class="name">
					我的订单
				</view>
			</view>
			<view class="itembanner" @click="waitlook">
				<view class="iconfont icon-dingwei1">
					
				</view>
				<view class="name">
					预设地址
				</view>
			</view>
			<view class="itembanner " @click="waitlook">
				<view class="iconfont icon-kefu">
					
				</view>
				<view class="name">
					客服中心
				</view>
			</view>
			<view class="itembanner" @click="waitlook">
				<view class="iconfont icon-shoucang">
					
				</view>
				<view class="name">
					我的收藏
				</view>
			</view>
		</view>
		<view class="board" @click="waitlook">
			<view class="iconfont icon-vip-l">
				
			</view>
			<view class="content">
				<view class="name1">
					健康记录
				</view>
				<view class="title1">
					开通会员，每天记录健康数据
				</view>
			</view>
			<view class="adsbtn">
				立即参与
			</view>
		</view>
		<view class="line" @click="gomyinfo">
			<view class="left">
				<view class="iconfont icon-wode">
					
				</view>
				<view class="value">
					个人信息
				</view>
			</view>
			<view class="right">
				详情
				<view class="iconfont icon-xiangyou1">
					
				</view>
			</view>
		</view>
		<view class="line" @click="gofriend">
			<view class="left">
				<view class="iconfont icon-tuandui">
					
				</view>
				<view class="value">
					亲友关爱
				</view>
			</view>
			<view class="right">
				详情
				<view class="iconfont icon-xiangyou1">
					
				</view>
			</view>
		</view>
		<view class="line" @click="goteam">
			<view class="left">
				<view class="iconfont icon-tuandui1">
					
				</view>
				<view class="value">
					我的专家团队
				</view>
			</view>
			<view class="right">
				详情
				<view class="iconfont icon-xiangyou1">
					
				</view>
			</view>
		</view>

		<view class="line" @click="goplan">
			<view class="left">
				<view class="iconfont icon-jishiben">
					
				</view>
				<view class="value">
					我的随访计划
				</view>
			</view>
			<view class="right">
				详情
				<view class="iconfont icon-xiangyou1">
					
				</view>
			</view>
		</view>
		<view class="line" @click="myeq">
			<view class="left">
				<view class="iconfont icon-qingdan">
					
				</view>
				<view class="value">
					我的设备
				</view>
			</view>
			<view class="right">
				详情
				<view class="iconfont icon-xiangyou1">
					
				</view>
			</view>
		</view>
		
		
	
	</view>
</template>

<script>
		import {getInfo,uploadInfo} from '../../utils/api.js'
	export default {
		data() {
			return {
				pro:{},
				imgurl:'/img/微信图片_20250923172704_692_133.jpg'
			}
		},
		onShow() {
			  let p={
				  phone:uni.getStorageSync('phone')
			  }
			getInfo(p).then(res=>{
				console.log(res,'个人信息')
				
				this.pro=res.data.data.info
				this.imgurl=res.data.data.info.imgUrl
			})
		},
		methods: {
			myeq(){
				uni.navigateTo({
					url:'/pagesA/bluetooth/bluetooth'
				})
			},
			
			myorder(){
				uni.navigateTo({
					url:'/pagesA/myorder/myorder'
				})
			},
			waitlook(){
				uni.showToast({
					title: '敬请期待',
					icon:'none',
					duration: 2000
				});
			},
			changetouxiang(){
				let that=this
				uni.chooseImage({
					count: 1, 
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album','camera'], //直接拍照
					success: function (res) {
						
						let url=res.tempFilePaths[0]
						uni.uploadFile({
									//url: 'http://192.168.10.93:8989/api/commonApi/uploadFile', 
									url: 'https://changban.dianjingkeji.net/prod-api/api/commonApi/uploadFile',
									filePath: url,
									name: 'file',
									success: (uploadFileRes) => {
										let p={
											imgUrl:JSON.parse(uploadFileRes.data).fileName,
											memberPhone:uni.getStorageSync('phone')
										}
									let imgurl=JSON.parse(uploadFileRes.data).fileName
									uploadInfo(p).then(res=>{
										console.log(res)
										if(res.data.code==200){
											uni.showToast({
												title: '头像更改成功',
												duration: 1000
											});
											that.imgurl=imgurl

										}
									})
									},
									 fail: (err) => {
									        console.error('上传失败：', err);
									      }
									
								});
					}
				});
			},
			gomyinfo(){
				uni.navigateTo({
					url:'/pagesB/myinfo/myinfo'
				})
			},
			gofriend(){
				uni.showToast({
					title: '敬请期待',
					icon:'none',
					duration: 2000
				});
				// uni.navigateTo({
				// 	url:'/pagesB/care/care'
				// })
			},
			goteam(){
		     if(this.pro.memberLevel!=3){
				 uni.showToast({
				 	title: '未开通专病服务',
				 	icon:'none',
				 	duration: 2000
				 });
				 return
			 }
				uni.navigateTo({
					url:'/pagesB/mydoctorteam/mydoctorteam'
				})
			},
			goplan(){
				let sid=this.pro.serviceId
				uni.navigateTo({
					url:'/pagesB/plan/plan?sid='+sid
				})
			
			},
			
		}
	}
</script>

<style lang="less" scoped>
  .page{
	  width: 750rpx;
	  box-sizing: border-box;
	  .topbox{
		  background-color: #1a4f8a;
		  width: 100%;
		  height: 320rpx;
		  box-sizing: border-box;
		  padding-top: 40rpx;
		  .infobox{
			  width: 90%;
			  margin:auto ;
			  display: flex;
			  align-items: center;
			  .imgbox{
				  width: 130rpx;
				  height: 130rpx;
				  border-radius: 50%;
				  margin-right: 20rpx;
				  image{
					  width: 100%;
					  height: 100%;
					  border-radius: 50%;
					  
				  }
			  }
			  .info{
				  color: white;
				   line-height: 2;
				  .nameline{
					  display: flex;
					  align-items: center;
					  .name{
						  font-weight: bold;
					  }
					  .user{
						  border-radius: 26rpx;
						  padding: 4rpx 16rpx;
						 background: linear-gradient(180deg, rgba(255,249,196,1) 0%,rgba(255,168,0,1) 100%);
						  font-size: 26rpx;
						  margin-left: 20rpx;
						 color: rgba(108,72,2,1);
					  }
				  }
			  }
		  }
		  .backbox{
		  		  width: 90%;
		  		  margin: 30rpx auto;
		  		  background-color:rgba(0, 0, 0, 0.3);
		  		  height: 100rpx ;
				  border-top-right-radius: 20rpx;
				  border-top-left-radius: 20rpx;
				  box-sizing: border-box;
				  padding: 20rpx;
				  display: flex;
				  align-items: center;
				  justify-content: center;
				  color: #FFE500 ;
				  font-weight: bold;
				  font-size: 28rpx;
				  .iconfont{
					  font-size: 40rpx;
				  }
				  .more{
					  display: flex;
					  align-items: center;
					  color: rgba(255,255,255,0.6);
					  font-size: 28rpx;
					  margin-left: 20rpx;
				  }
		  }
	  }
	  .bannerbox{
		  width: 92%;
		  background-color: white;
		  margin: auto;
		  border-radius: 20rpx;
		  box-sizing: border-box;
		  padding: 20rpx;
		  box-shadow: 0 0 10rpx 0 rgba(0,0,0,0.3);
		  display: flex;
		  align-items: center;
		  justify-content: space-evenly;
		  text-align: center;
		  margin-top: -40rpx;
		  .itembanner{
			  line-height: 2;
			  .iconfont{
				  margin: auto;
				  color: #1a4f8a;
				  font-weight: bold;
				  font-size: 40rpx;
			  }
			  .name{
				  font-size: 28rpx;
				   font-weight: bold;
				  
			  }
		  }
	  }
	  .board{
		 width: 92%;
		 background: linear-gradient(180deg, rgba(58,92,134,1) 0%,rgba(9,43,81,1) 100%);
		 margin:20rpx auto;
		 border-radius: 20rpx;
		 box-sizing: border-box;
		 padding: 20rpx;
		 display: flex;
		 align-items: center;
		 justify-content: space-evenly;
		margin-bottom: 40rpx;
		 .iconfont{
			 color: #FFC700;
			 font-weight: bold;
		 }
		 .content{
			 .name1{
				 font-weight: bold;
				 font-size: 30rpx;
				 color: #FFC700 ;
			 }
			 .title1{
				 font-size: 24rpx;
				 color:rgba(255, 255, 255, 0.3) ;
			 }
		 }
		 .adsbtn{
			 border-radius: 26rpx;
			  padding: 4rpx 16rpx;
			 background: linear-gradient(180deg, rgba(255,249,196,1) 0%,rgba(255,168,0,1) 100%);
			  font-size: 26rpx;
			  margin-left: 20rpx;
			 color: rgba(108,72,2,1);
		 }
		
	  }
	  .line{
		  width: 100%;
		  box-sizing: border-box;
		  height: 86rpx;
		  line-height: 86rpx;
		  display: flex;
		  align-items: center;
		  justify-content: space-between;
		  padding: 2rpx 30rpx;
		  background-color: white;
		  border-bottom: 1rpx solid whitesmoke;
		  font-size: 30rpx;
		  .left{
			  display: flex;
			  align-items: center;
			  font-weight: bold;
			  .iconfont{
				  color: #1a4f8a;
				  font-size: 40rpx;
			  }
		  }
		  .right{
			  display: flex;
			  align-items: center;
			  color: #BDBDBD;
		  }
	  }
	  
	  
	  
	  
	  
	  
	  
	 
  }
</style>
